#!/bin/bash

source /etc/profile
dir="/usr/tmp/SQLDumpSplitterResult"
host="127.0.0.1"
user="root"
password="123456"
fileName="position_type_info_v2"


# 创建表
ctablePath="${dir}/${fileName}_DataStructure.sql"

# 登录mysql并执行sql脚本
mysql -h $host -u$user -p$password -e "
	CREATE DATABASE lianxi;
	USE lianxi;
	SOURCE ${ctablePath}";

# 插入数据
for i in {1..156}
do
	file="${dir}/${fileName}_${i}.sql"
	echo "-- 正在执行${file}"
	mysql -h${host} -u${user} -p${password} -e "
		USE lianxi;
		SOURCE ${file};"; 
	echo "\n--- 插入成功 - -"
done
